package com.allwees.bs.c.module.user.dto;

import com.allwees.bs.c.module.user.entity.UserCouponEntity;
import com.allwees.bs.core.model.user.constant.ECouponDefType;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Data
@NoArgsConstructor
public class UserCouponDTO implements Serializable {

    private static final long serialVersionUID = -5382001026853546537L;
    //
    private String uuid;
    private String no;
    private ECouponDefType couponType;
    private BigDecimal discountRate;
    private Date receiveDate;
    private Date overdueTime;
    private BigDecimal maxDeductAmt;
    private String valueText;
    private String name;

    public UserCouponDTO(UserCouponEntity entity){
        BeanUtils.copyProperties(entity, this);
        this.discountRate = entity.getFaceValue();
        this.name = entity.getCouponName();
        this.no = entity.getNo();
    }
}